/*
 * Player.java
 *
 * Created on 17 maggio 2008, 14.55
 */

/**
 *
 * @author  udelledo
 */
public class Player extends javax.swing.JPanel {
    
    /** Creates new form Player */
    public Player() {
        initComponents();
    }

    public Player(String name) {
        initComponents();
        this.name.setText(name);
    }
    
    public Player(String name,int gpoint, int mpoint) {
        initComponents();
        this.name.setText(name);
        this.gameScore.setText(Integer.toString(gpoint));
        this.matchScore.setText(Integer.toString(mpoint));
    }    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        jPanel1 = new javax.swing.JPanel();
        name = new javax.swing.JLabel();
        matchScore = new javax.swing.JLabel();
        gameScore = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 100, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 100, Short.MAX_VALUE)
        );

        setBackground(new java.awt.Color(255, 0, 0));
        name.setText("Nome Giocatore");

        matchScore.setText("Punteggio Match");

        gameScore.setText("Punteggio Partita");

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 57, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 53, Short.MAX_VALUE)
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(name)
                .addContainerGap(52, Short.MAX_VALUE))
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(35, Short.MAX_VALUE)
                .add(matchScore)
                .addContainerGap())
            .add(layout.createSequentialGroup()
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(32, Short.MAX_VALUE)
                .add(gameScore)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(name)
                .add(56, 56, 56)
                .add(matchScore)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(gameScore)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 48, Short.MAX_VALUE)
                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel gameScore;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JLabel matchScore;
    private javax.swing.JLabel name;
    // End of variables declaration//GEN-END:variables

    public void setName (String name){
        this.name.setText(name);
    }
    
    public void setMatchScore(int score){
        this.matchScore.setText(Integer.toString(score));
    }
    
    public void setGameScore(int score){
        this.gameScore.setText(Integer.toString(score));
    }
    
    public String getName(){
        return this.name.getText();
    }
    
    public int getMatchScore(){
        return Integer.parseInt(this.matchScore.getText());
    }
    
    public int getGameScore(){
        return Integer.parseInt(this.gameScore.getText());
    }
    
}
